
<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;

$indexes = array (
	date_begin=>array (label=>"Date Begin",order=>"DEFAULT",wrapper=>"vmc_icon_time_in"),
	date_end=>array (label=>"Date End",order=>"DEFAULT",wrapper=>"vmc_icon_time_out"),
	total_time=>array (label=>"Total Time",order=>"DEFAULT",wrapper=>"vmc_icon_total_time"),
);

$object_ctl = "/admin/users/timesheet/?fs_action=view&fs_tab=main&fs_tab_option=fs_timesheet&";
$link_options = "";
$list_options = array ();

$_OBJECT_IFACE_LIST = _app_create_list_object (array (
                db_conn=>$_GLOBAL_DBH,
                indexes=>$indexes,
		list_count=>"SELECT COUNT(*) FROM timesheet WHERE user_id={$_APP_SESSION_USER->id}",
		list_select=>"SELECT id,date_begin,CASE date_end WHEN '' THEN CURRENT_TIMESTAMP() ELSE date_end END AS date_end,SEC_TO_TIME(CASE date_end WHEN '' THEN UNIX_TIMESTAMP() ELSE UNIX_TIMESTAMP(date_end) END - UNIX_TIMESTAMP(date_begin)) AS total_time FROM timesheet WHERE user_id={$_APP_SESSION_USER->id}",
                list_id=>"lc_timesheets",
		list_title=>"&nbsp;&raquo;&nbsp;User Timesheet",
                list_options=>$list_options,
                primary_key=>"id",
                primary_relation=>"timesheet_id",
                link_options=>$link_options,
                object_ctl=>$object_ctl
));


$_OBJECT_IFACE_PANEL->insert_container ($_OBJECT_IFACE_LIST);

?>
